﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Windows.Input;

using System.Windows;



namespace GWPresentation
{
   public static  class XnaCommandBinder
    {

        static RoutedCommand show3dWindow = new RoutedCommand();

        public static RoutedCommand Show3dWindow
        {
            get { return XnaCommandBinder.show3dWindow; }
           
        }





        /// <summary>
        /// 将命令绑定到窗体
        /// </summary>
        /// <param name="window"></param>
        public static void BindCommandsToWindow(Window window)
        {


            CommandBinding cbShow3d = new CommandBinding();
            cbShow3d.Command = show3dWindow;
            cbShow3d.Executed += new ExecutedRoutedEventHandler(cbShow3d_Executed);
            cbShow3d.CanExecute += new CanExecuteRoutedEventHandler(cbShow3d_CanExecute);

            window.CommandBindings.Add(cbShow3d);



        }

        static void cbShow3d_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
        }

        static void cbShow3d_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            //测试一下速度较慢的XNA,到底有多慢

            winXNA xna = new winXNA();

            xna.ShowDialog();
           

        }



    }
}
